#include<iostream>
#include "BookShelf.h"
#include "Book.h"

int main ()
{
    BookShelf bookshelf;

    bookshelf.appendBook(Book("Arround the World in 80 Days"));
    bookshelf.appendBook(Book("Bible"));
    bookshelf.appendBook(Book("Daddy Long legs"));

    auto iter = bookshelf.iterator();
    
    /* iterator version of traverse */
    // while loop didn't rely on the implementation of BookShelf, and always runnnig well 
    // only if iter can return objects correctly no matter what data structure BookShelf uses.
    while(iter->hasNext())
        std::cout << "BookShelfIter: " << iter->next().getname() << std::endl;
    std::cout << "iterator have finished traverse." << std::endl;

    return 0;
}
